

package com.hazelcast.splitbrainprotection.impl;

import com.hazelcast.cluster.Member;
import com.hazelcast.splitbrainprotection.SplitBrainProtectionFunction;

import java.util.Collection;

class MemberCountSplitBrainProtectionFunction implements SplitBrainProtectionFunction {

    private final int splitBrainProtectionSize;

    MemberCountSplitBrainProtectionFunction(int splitBrainProtectionSize) {
        this.splitBrainProtectionSize = splitBrainProtectionSize;
    }

    @Override
    public boolean apply(Collection<Member> members) {
        return members.size() >= splitBrainProtectionSize;
    }
}
